//
//  MyCollectionPeopleTableViewCell.m
//  MyProject
//
//  Created by jiaming yan on 2018/3/27.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "MyCollectionPeopleTableViewCell.h"

@implementation MyCollectionPeopleTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

}
-(void)setDataWithModel:(CollectionCompanyModel *)model{
    
    if (model.hasAssurePassService) {
        self.sureImageView.hidden = NO;
    }else{
        self.sureImageView.hidden = YES;
    }
    self.nameLabel.text = model.nickName;
    self.positionLabel.text = [NSString stringWithFormat:@"-%@",model.positionName];
    self.yearLabel.text = [NSString stringWithFormat:@"已在职%zd年 | 帮助过%zd人",model.inServiceTime,model.helpedCount];
    self.addressLabel.text = [NSString stringWithFormat:@"%@",model.companyName];
    self.scoreLabel.text = [NSString stringWithFormat:@"%.0f%@",model.degreeOfSatisfaction*100,@"%"];
    
    CAShapeLayer *layerBack = [[CAShapeLayer alloc]init];
    layerBack.lineWidth = 4;
    //圆环的颜色
    layerBack.strokeColor = UIColorFromRGB(0xE2F2F4).CGColor;
    //背景填充色
    layerBack.fillColor = [UIColor clearColor].CGColor;
    //设置半径为10
    CGFloat radius = 22;
    //按照顺时针方向
    BOOL clockWise = true;
    //初始化一个路径
    UIBezierPath *pathBack = [UIBezierPath bezierPathWithArcCenter:CGPointMake(22 , 22 ) radius:radius startAngle:0 endAngle:2*M_PI clockwise:clockWise];
    //             UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(78 , 78 - 1 ) radius:radius startAngle:(2*M_PI) endAngle:(_score/100.0*2)*M_PI clockwise:clockWise];
    layerBack.path = [pathBack CGPath];
    [self.scoreView.layer addSublayer:layerBack];
    
    
    CAShapeLayer *layer = [CAShapeLayer new];
    layer.lineWidth = 4;
    //圆环的颜色
    layer.strokeColor = UIColorFromRGB(0x42CDD9).CGColor;
    //背景填充色
    layer.fillColor = [UIColor clearColor].CGColor;
    //设置半径为10
    
    
    //初始化一个路径
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(22 , 22 ) radius:radius startAngle:3*M_PI_2 endAngle:(model.degreeOfSatisfaction*2*M_PI+3*M_PI_2) clockwise:clockWise];
    layer.path = [path CGPath];
    [self.scoreView.layer addSublayer:layer];
}
-(void)loadData{
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
